<?php
// ----- >> Extends From Template
class thisPDF extends PDF{
	function Header(){}
	function Footer(){}
}

function terbilang_get_valid($str,$from,$to,$min=1,$max=9){
      $val=false;
      $from=($from<0)?0:$from;
      for ($i=$from;$i<$to;$i++){
        if (((int) $str{$i}>=$min)&&((int) $str{$i}<=$max)) $val=true;
      }
      return $val;
  } 

  function terbilang_get_str($i,$str,$len){
      $numA=array("","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan");
      $numB=array("","se","dua ","tiga ","empat ","lima ","enam ","tujuh ","delapan ","sembilan ");
      $numC=array("","satu ","dua ","tiga ","empat ","lima ","enam ","tujuh ","delapan ","sembilan ");
      $numD=array(0=>"puluh",1=>"belas",2=>"ratus",4=>"ribu", 7=>"juta", 10=>"milyar", 13=>"triliun");
      $buf="";
      $pos=$len-$i;
      switch($pos){
        case 1:
            if (!terbilang_get_valid($str,$i-1,$i,1,1))
              $buf=$numA[(int) $str{$i}];
          break;
        case 2: case 5: case 8: case 11: case 14:
            if ((int) $str{$i}==1){
              if ((int) $str{$i+1}==0)
                $buf=($numB[(int) $str{$i}]).($numD[0]);
              else
                $buf=($numB[(int) $str{$i+1}]).($numD[1]);
            }
            else if ((int) $str{$i}>1){
                $buf=($numB[(int) $str{$i}]).($numD[0]);
            }       
          break;
        case 3: case 6: case 9: case 12: case 15:
            if ((int) $str{$i}>0){
                $buf=($numB[(int) $str{$i}]).($numD[2]);
            }
          break;
        case 4: case 7: case 10: case 13:
            if (terbilang_get_valid($str,$i-2,$i)){
              if (!terbilang_get_valid($str,$i-1,$i,1,1))
                $buf=$numC[(int) $str{$i}].($numD[$pos]);
              else
                $buf=$numD[$pos];
            }           else if((int) $str{$i}>0){
              if ($pos==4)
                $buf=($numB[(int) $str{$i}]).($numD[$pos]);
              else
                $buf=($numC[(int) $str{$i}]).($numD[$pos]);
            }
          break;
      }
      return $buf;
  }
  function toTerbilang($nominal){
      $buf="";
      $str=$nominal."";
      $len=strlen($str);
      
      for ($i=0;$i<$len;$i++){
        $buf=trim($buf)." ".terbilang_get_str($i,$str,$len);
      }
      return trim($buf);
  }

// ----- >> Init
$fpdf = new thisPDF('P','mm','A4');
$fpdf->AddPage();
$fpdf->SetLeftMargin(8);

$fpdf->Ln(0);


$time = date('d-M-y');

// ----- >> Header
$fpdf->Ln(30);
$fpdf->SetFont('Arial','B',10);
$fpdf->Cell(60,5,"",0,0,'L');
$fpdf->Cell(140,2,"SURAT IZIN PENYELENGGARAN KEGIATAN",0,0,'L');
$fpdf->Ln(5);
$fpdf->SetFont('Arial','BU',10);
$fpdf->Cell(65,5,"",0,0,'L');
$fpdf->Cell(140,5,"PRIMKOKAS - KRAKATAU JUNCTION",0,0,'L');
$fpdf->Ln(5);
$fpdf->SetFont('Arial','',10);
$fpdf->Cell(80,5,"",0,0,'L');
$fpdf->Cell(140,5,"".$data['no_surat']." ",0,0,'L');
$fpdf->Ln(10);

$fpdf->SetFont('Arial','',10);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"Puji syukur ke hadirat Tuhan Yang Maha Esa, teriring doa semoga Bapak dalam ",0,0,'L');
$fpdf->Ln(5);

$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"keadaan sehat walafiat dan senantiasa mendapat  lindungan-Nya di dalam ",0,0,'L');
$fpdf->Ln(5);

$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"menjalankan tugas sehari-hari. Amin.",0,0,'L');


$fpdf->Ln(10);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"Dengan ini Primkokas Memberikan Izin Kepada :",0,0,'L');
$fpdf->Ln(5);

$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Nama Pelanggan",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');

$fpdf->Cell(140,5,$data['nama_penyelenggara'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Alamat",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['alamat'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Diwakili Oleh",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['diwakili_oleh'],0,0,'L');
$fpdf->Ln(10);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Adapun keterangan kegiatan adalah sebagai berikut :",0,0,'L');
$fpdf->Ln(5);

$fpdf->Cell(20,5,"",0,0,'L');

$fpdf->Cell(40,5,"Nama Kegiatan",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['nama_kegiatan'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');

$fpdf->Cell(40,5,"Keterangan Kegiatan",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');

$fpdf->Cell(140,5,$data['catatan_kegiatan'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Hari/Tanggal Kegiatan",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['tanggal_mulai_kegiatan']." S/D:".$data['tanggal_selesai_kegiatan'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Pukul",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['pukul'],0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(40,5,"Tempat Kegiatan",0,0,'L');
$fpdf->Cell(2,5,":",0,0,'L');
$fpdf->Cell(140,5,$data['tempat_kegiatan'],0,0,'L');
$fpdf->Ln(10);

$fpdf->SetFont('Arial','',10);

$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"Dengan Catatan Sebagai Berikut :",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"1. Menjaga norma-norma kesopanan.",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"2. Tidak mengganggu kenyamanan Krakatau Junction.",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"3. Menjaga keamanan, ketertiban dan kebersihan selama kegiatan berlangsung.",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"4. Tidak diperkenankan membawa senjata tajam, minuman beralkohol dan benda",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"     lainnya yang melanggar hukum di area Krakatau Junction",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"5. Apabila terjadi pelanggaran, maka pihak keamanan Krakatau Junction berhak untuk",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"     meberhentikan kegiatan tersebut.",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"Demikian surat keterangan ini kami buat untuk dapat di pergunakan sebagaimana",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(140,5,"mestinya.",0,0,'L');
$fpdf->Ln(5);


$fpdf->SetFont('Arial','',10);
$fpdf->Cell(155,5,"",0,0,'L');
$fpdf->Cell(10,5,"Cilegon, ".$time,0,0,'R');
$fpdf->Ln(7);

$fpdf->Cell(35,5,"",0,0,'L');
$fpdf->Cell(87,5,"Mengetahui ",0,0,'L');
$fpdf->SetFont('Arial','B',10);
$fpdf->Cell(10,5,"PRIMER KOPERASI KARYAWAN ",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(133,5,"",0,0,'L');
$fpdf->Cell(10,5,"KRAKATAU STEEL",0,0,'L');
$fpdf->SetFont('');
$fpdf->Ln(25);


//$fpdf->Image(APPPATH . 'file/media/ttd_isp.jpg');
//$fpdf->Ln(5);
$fpdf->Cell(34,5,"",0,0,'L');
$fpdf->SetFont('Arial','BU',10);
$fpdf->Cell(108,5,"Aan Supriana",0,0,'L');
$fpdf->Cell(10,5,"Ngajito",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(15,5,"",0,0,'L');
$fpdf->SetFont('');
$fpdf->Cell(123,5,"Internal Busines & Property Div. Manager",0,0,'L');
$fpdf->Cell(10,5,"Property Div.",0,0,'L');
$fpdf->Ln(10);
$fpdf->SetFont('');
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(123,5,"Tembusan : ",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(90,5,"    1. Yth. Ketua Umum PRIMKOKAS  ",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(90,5,"    2. Yth. IB & Property Div. Mgr ",0,0,'L');
$fpdf->Ln(5);
$fpdf->Cell(20,5,"",0,0,'L');
$fpdf->Cell(90,5,"    3. Arsip  ",0,0,'L');
$fpdf->Ln(5);




$date = date('d-M-y');
echo $fpdf->Output('SURAT IZIN PENYELENGGARAN KEGIATAN'." "."$date"." ".'.pdf','I');
exit();
?>
<!-- 

 -->